package com.cloudfun.campusshare.common.model.vo;

import com.cloudfun.campusshare.common.constant.BaseConstant;
import com.cloudfun.campusshare.common.constant.RoleType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "注册信息")
public class RegisterVO {

    @ApiModelProperty(value = "手机号")
    @NotEmpty(message = "手机号不能为空")
    @Pattern(regexp = BaseConstant.PHONE_REGEX_PATTERN, message = "手机号错误")
    private String phone;

    @ApiModelProperty(value = "密码")
    @NotEmpty(message = "密码不能为空")
    @Length(min = 8, max = 20, message = "密码限制8-20个字")
    @Pattern(regexp = BaseConstant.PASSWORD_REGEX_PATTERN, message = "密码格式错误")
    private String password;

    @ApiModelProperty(value = "密码")
    @NotEmpty(message = "密码不能为空")
    @Length(max = 20, message = "密码限制20个字")
    @Pattern(regexp = BaseConstant.PASSWORD_REGEX_PATTERN, message = "密码格式错误")
    private String passwordConfirm;

    @ApiModelProperty(value = "验证码")
    @NotEmpty(message = "验证码不能为空")
    @Length(max = 6, message = "验证码限制6个字")
    private String inputCode;

    @ApiModelProperty(value = "用户名")
    @Length(min = 2, max = 12, message = "用户名限制2-12个字符")
    @Pattern(regexp = BaseConstant.ALPHABET_DIGITAL_CHINESE, message = "用户名错误")
    private String userName;

    @ApiModelProperty(value = "邮箱")
    @Length(min = 2, max = 40, message = "邮箱过长，限制2-40个字")
    @Pattern(regexp = BaseConstant.EMAIL_REGEX_PATTERN, message = "邮箱错误")
    private String email;

    @ApiModelProperty(value = "是否接受协议")
    private boolean agree;

    @ApiModelProperty("企业名称")
    @Length(min = 2, message = "企业名称必须大于两个字符")
    private String enterpriseName;

    @ApiModelProperty("角色")
    private RoleType roleType;
}
